import { Injectable } from '@angular/core';
import { BaseService } from '@core/routes-services/base.service';
import { CacheService } from '@core/routes-services/cache.service';
import { HttpClient } from '@angular/common/http';

/**
 * cos文件 服务
 */
@Injectable()
export class QcloudService extends BaseService {
  constructor(http: HttpClient, cacheService: CacheService) {
    super(http, cacheService);
  }

  base_url: any = 'fileUpload';


  /**
   * 获取临时签名
   *
   * @returns {Promise<any>}
   */
  buildAuthorizationStr(): Promise<any> {
    const url = this.base_url + '/authorization';
    return this.post(url, null);
  }

  /**
   * 删除文件
   *
   * @returns {Promise<any>}
   */
  deleteFileByKey(key: any): Promise<any> {
    const url = this.base_url + '/delete';
    return this.put(url, { 'key': key });
  }


}
